package com.itheima.mapper;

import com.itheima.bean.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Student_TestIf {

    //修改
    @Update("update student set id=#{id},name=#{name},age=#{age},birthday=#{birthday} where id=#{id}")
    public Integer update(Student student) throws Exception;

    //查询全部
    @Select("select * from student")
    public List<Student> selectAll() throws Exception;

    //新增
    @Insert("insert into student value(#{id},#{name},#{age},#{birthday})")
    public Integer insert(Student student) throws Exception;

    //根据id查询
    @Select("select * from student where id=#{id}")
    public Student selectById(Integer id) throws Exception;

    //删除
    @Delete("delete from student where id=#{id}")
    public Integer delete(Integer id) throws Exception;

}
